package com.byx.chatclient.http;

import com.byx.chatclient.bean.ChooseGroupBean;
import com.byx.chatclient.bean.Group;
import com.byx.chatclient.bean.GroupChatInfo;
import com.byx.chatclient.bean.SearchGroupBean;
import com.byx.chatclient.bean.SearchUserBean;
import com.byx.chatclient.bean.SimpleGroupBean;
import com.byx.chatclient.bean.SimpleUserBean;
import com.byx.chatclient.bean.UserAndGroup;
import com.byx.chatclient.entity.Friend;
import com.byx.chatclient.entity.GroupDto;
import com.byx.chatclient.entity.Result;
import com.byx.chatclient.entity.SimpleFriend;
import com.byx.chatclient.entity.User;
import com.byx.chatclient.pojo.FriendParam;

import java.util.List;
import java.util.Map;

import okhttp3.MultipartBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Path;
import retrofit2.http.Query;

/**
 * ActionRequest
 * 操作请求接口
 * @author Superb
 * @date 2021/4/26 12:27
 */
public interface ActionRequest {

    @GET("action/getUserById")
    Call<Result<User>> queryUserInfoById(@Query("id") Long id);

    @GET("action/getUserByLoginId")
    Call<Result<User>> queryUserInfoByLoginId(@Query("loginId") String loginId);

    @GET("action/queryUserSimpleInfo/{id}")
    Call<Result<SimpleUserBean>> queryUserSimpleInfoById(@Path("id") Long id);

    @POST("action/createGroup")
    Call<Result<Void>> createGroup(@Body Group group);

    @POST("action/fuzzySearchAll")
    @FormUrlEncoded
    Call<Result<UserAndGroup>> fuzzySearch(@Field("searchKey") String searchKey);

    @POST("action/fuzzySearchUser")
    @FormUrlEncoded
    Call<Result<List<SearchUserBean>>> fuzzySearchUser(@Field("searchKey") String searchKey);

    @POST("action/fuzzySearchGroup")
    @FormUrlEncoded
    Call<Result<List<SearchGroupBean>>> fuzzySearchGroup(@Field("searchKey") String searchKey);

    @GET("/friend/queryFriends/{id}")
    Call<Result<List<SimpleFriend>>> queryAllFriends(@Path("id") Long id);

    @GET("/friend/queryFriendDetailInfo/{userId}/{friendId}")
    Call<Result<Friend>> queryFriendDetailInfo(@Path("userId") Long userId, @Path("friendId") Long friendId);

    @GET("/friend/queryFriendDetailInfoByLoginId/{userId}/{friendLoginId}")
    Call<Result<Friend>> queryFriendDetailInfoByLoginId(@Path("userId") Long userId, @Path("friendLoginId") String friendLoginId);

    @POST("friend/add")
    Call<Result<Void>> addFriend(@Body FriendParam friendParam);

    @GET("action/queryFriendGroup/{id}")
    Call<Result<List<ChooseGroupBean>>> queryUserFriendGroup(@Path("id") Long userId);

    @POST("action/addFriendGroup")
    Call<Result<Integer>> addFriendGroup(@Body ChooseGroupBean groupBean);

    @GET("action/queryUserGroup/{id}")
    Call<Result<Map<Integer,List<SimpleGroupBean>>>> queryUserGroup(@Path("id") Long userId);

    @GET("action/queryUserGroupDetail")
    Call<Result<GroupDto>> queryUserGroupDetail(@Query("userId") Long userId, @Query("groupId") Long groupId);

    @POST("action/changeUserInfo")
    Call<Result<Void>> changeUserInfo(@Body User user);

    @Multipart
    @POST("action/changeUserAvatar")
    Call<Result<String>> changeUserAvatar(@Part("userId") String userId, @Part MultipartBody.Part file,@Part("timestamp") Long timestamp);

    @POST("friend/changeFriendRemark")
    @FormUrlEncoded
    Call<Result<Void>> changeFriendRemark(@Field("userId") Long userId, @Field("friendId") Long friendId, @Field("remark") String remark);

    @POST("friend/delete")
    @FormUrlEncoded
    Call<Result<Void>> deleteFriend(@Field("userId") Long userId,@Field("friendId") Long friendId);
}
